package gbm;
// Code FeatureEntry.java
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.BoxLayout;
import javax.swing.JSplitPane;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import java.awt.Font;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JSlider;
import javax.swing.SwingConstants;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import javax.swing.ListSelectionModel;
import javax.swing.DropMode;

public class FeatureEntry extends JFrame {

	private JPanel contentPane;
	private JTextField txtTP53mRNA;
	private JTextField txtGABRA1mRNA;
	private JTextField txtAge;
	static final int minPatient = 1;
	static final int maxPatient = 10;
	private JTextField textField;
	private JTable table;
	private JTable table_1;
	String therapySequence = "";
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					FeatureEntry frame = new FeatureEntry();
					frame.setVisible(true);
					
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public FeatureEntry() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 800);
		contentPane = new JPanel();
		contentPane.setSize(1000, 1000);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	
	   
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblHeader = new JLabel("ENTER PATIENT DATA");
		lblHeader.setFont(new Font("Lucida Grande", Font.BOLD, 19));
		lblHeader.setBounds(269, 24, 238, 16);
		contentPane.add(lblHeader);
		
		JLabel lblNewPatient = new JLabel("New Patient :");
		lblNewPatient.setBounds(40, 75, 91, 16);
		contentPane.add(lblNewPatient);
		
		JRadioButton rdbtnYes = new JRadioButton("Yes");
		rdbtnYes.setBounds(146, 71, 66, 23);
		contentPane.add(rdbtnYes);
		
		JRadioButton rdbtnNo = new JRadioButton("No");
		rdbtnNo.setBounds(224, 71, 66, 23);
		contentPane.add(rdbtnNo);
		
		JLabel lblMGMT = new JLabel("Patient's MGMT methylation status :");
		lblMGMT.setBounds(40, 118, 250, 16);
		contentPane.add(lblMGMT);
		
		JComboBox cmbBxMGMT = new JComboBox();
		cmbBxMGMT.setBounds(288, 114, 119, 27);
		cmbBxMGMT.addItem("Methylated");
		cmbBxMGMT.addItem("Unmethylated");
		contentPane.add(cmbBxMGMT);
		
		JLabel lblTP53mRNA = new JLabel("TP53 mRNA expression (z-score) : ");
		lblTP53mRNA.setBounds(40, 163, 226, 16);
		contentPane.add(lblTP53mRNA);
		
		JLabel lblGABRA1mRNA = new JLabel("GABRA1 mRNA expression (z-score) : ");
		lblGABRA1mRNA.setBounds(40, 202, 250, 16);
		contentPane.add(lblGABRA1mRNA);
		
		txtTP53mRNA = new JTextField();
		txtTP53mRNA.setBounds(288, 157, 108, 28);
		contentPane.add(txtTP53mRNA);
		txtTP53mRNA.setColumns(10);
		
		txtGABRA1mRNA = new JTextField();
		txtGABRA1mRNA.setColumns(10);
		txtGABRA1mRNA.setBounds(289, 196, 108, 28);
		contentPane.add(txtGABRA1mRNA);
		
		JLabel lblNeoAdjNewPatient = new JLabel("Do you advise neo-adjuvant therapy for the patient?");
		lblNeoAdjNewPatient.setBounds(40,331, 358, 16);
		contentPane.add(lblNeoAdjNewPatient);
		
		JComboBox cmbBxNeoAdj = new JComboBox();
		cmbBxNeoAdj.setBounds(389, 327, 76, 27);
		cmbBxNeoAdj.addItem("Yes");
		cmbBxNeoAdj.addItem("No");
		contentPane.add(cmbBxNeoAdj);
		
		JLabel lblKPS = new JLabel("Karnofsky Performance Score :");
		lblKPS.setBounds(40, 248, 211, 16);
		contentPane.add(lblKPS);
		
		JComboBox cmbBxKPS = new JComboBox();
		cmbBxKPS.setBounds(288, 244, 76, 27);
		for(int val = 10; val <=100; val=val+10){
			String strDropVal = ""+val;
			cmbBxKPS.addItem(strDropVal);
			
		}
		
		contentPane.add(cmbBxKPS);
		
		JLabel lblAge = new JLabel("Age :");
		lblAge.setBounds(205, 289, 61, 16);
		contentPane.add(lblAge);
		
		txtAge = new JTextField();
		txtAge.setBounds(288, 283, 52, 28);
		contentPane.add(txtAge);
		txtAge.setColumns(10);
		
		JLabel lblYears = new JLabel("Years");
		lblYears.setBounds(352, 289, 61, 16);
		contentPane.add(lblYears);
		
		JLabel lblNeoAdjOldPat = new JLabel("Has the patient undergone neo-adjuvant therapy? ");
		lblNeoAdjOldPat.setBounds(40, 366, 358, 16);
		contentPane.add(lblNeoAdjOldPat);
		
		JComboBox cmbBxNeoAdjOld = new JComboBox();
		cmbBxNeoAdjOld.setBounds(389, 362, 76, 27);
		cmbBxNeoAdjOld.addItem("Yes");
		cmbBxNeoAdjOld.addItem("No");
		contentPane.add(cmbBxNeoAdjOld);
		
		JLabel lblMedicationPrescribed = new JLabel("Treatment Plan followed ");
		lblMedicationPrescribed.setFont(new Font("Lucida Grande", Font.BOLD, 18));
		lblMedicationPrescribed.setBounds(227, 445, 238, 16);
		contentPane.add(lblMedicationPrescribed);
		
		final JComboBox cmbBxDrugList = new JComboBox();
		cmbBxDrugList.setBounds(158, 501, 108, 27);
		cmbBxDrugList.addItem("Temodar");
		cmbBxDrugList.addItem("Radiation");
		cmbBxDrugList.addItem("CCNU");
		cmbBxDrugList.addItem("Procarbazine");
		cmbBxDrugList.addItem("Vincristine");
		contentPane.add(cmbBxDrugList);
		
		JLabel lblChooseTherapy = new JLabel("Choose therapy");
		lblChooseTherapy.setBounds(40, 505, 108, 16);
		contentPane.add(lblChooseTherapy);
		
		
		
		final JTextArea txtAreaDrugs = new JTextArea();
		
		txtAreaDrugs.setRows(5);
		
		txtAreaDrugs.setBounds(478, 493, 304, 117);
		contentPane.add(txtAreaDrugs);
		
		
		JButton btnAdd = new JButton(">>");
		btnAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				String therapySelected = (String) cmbBxDrugList.getSelectedItem();
				if(therapySequence.equals("")){
					therapySequence = therapySelected;
				}else{
					therapySequence = therapySequence+"=>"+therapySelected;
				}
				
				txtAreaDrugs.setText(therapySequence);
				
				//tblTreatFollowed
			}
		});
		btnAdd.setBounds(312, 500, 81, 29);
		contentPane.add(btnAdd);
		
		JLabel lblSimMatch = new JLabel("Number of patients for similarity matching");
		lblSimMatch.setBounds(40, 573, 281, 16);
		contentPane.add(lblSimMatch);
		
		JSlider simPatientSlider = new JSlider();
		simPatientSlider.setPaintLabels(true);
		simPatientSlider.setSnapToTicks(true);
		simPatientSlider.setToolTipText("");
		simPatientSlider.setMinorTickSpacing(1);
		simPatientSlider.setPaintTicks(true);
		simPatientSlider.setMinimum(1);
		simPatientSlider.setMaximum(10);
		simPatientSlider.setBounds(40, 622, 190, 29);
		//simPatientSlider = new JSlider(JSlider.HORIZONTAL, minPatient, maxPatient);
		contentPane.add(simPatientSlider);
		
		textField = new JTextField();
		textField.setBounds(256, 622, 34, 28);
		contentPane.add(textField);
		textField.setColumns(10);
		
		JButton btnRecco = new JButton("Recommend Treatment");
		// Listener for clicking on the Recommend treatment button
		btnRecco.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				TreatmentResults tr = new TreatmentResults(); // creating object for Treatment Results frame
				
				tr.setVisible(true); // setting the visibility to true. 
				
			}
		});
		
		btnRecco.setBounds(523, 663, 189, 81);
		contentPane.add(btnRecco);
		
		
		
		//simPatientSlider.setPaintTicks(true);
		//simPatientSlider.setPaintLabels(true);
		
	}
	public JPanel getContentPane() {
		return contentPane;
	}
}
